/**
 * @param {string} haystack
 * @param {string} needle
 * @return {number}
 */
 var strStr = function(haystack, needle) {
    let n=haystack.length;
    let m=needle.length;
    for(let i=0;i+m<=n;i++){
       let flag=true; 
        for(let j=0;j<m;j++){
    if(haystack[i+j]!=needle[j]){
        flag=false;
        break;
    }
        }
    if(flag){
        return i;
    }}
    return -1;
    };
    